import QtQuick 1.1
import com.nokia.symbian 1.1

PageStackWindow {
    id: window
    initialPage: mainPage
    showStatusBar: true
    showToolBar: true

    MainPage {
        id: mainPage
        tools: toolBarLayout
    }

    AboutPage {
        id: aboutPage
        tools: toolBarLayout
    }

    ToolBarLayout {
        id: toolBarLayout
        ToolButton {
            flat: true
            iconSource: "toolbar-back"
            onClicked: window.pageStack.depth <= 1 ? Qt.quit() : window.pageStack.pop()
        }
        ToolButton {
            flat: true
            iconSource: "toolbar-menu"
            onClicked: {
                if (mainMenu.status === DialogStatus.Closed) {
                    mainMenu.open();
                } else {
                    mainMenu.close()
                }
            }
        }
    }

    Menu {
        id: mainMenu
        visualParent: pageStack
        MenuLayout {
            MenuItem {
                text: qsTr("About")
                enabled: pageStack.currentPage !== aboutPage
                onClicked: pageStack.push(aboutPage);
            }
            MenuItem {
                text: qsTr("Exit");
                onClicked: Qt.quit();
            }
        }
    }


}
